Add a warning when a grab fails
authorMatthias Clasen <mclasen@redhat.com>
Sat, 22 Feb 2020 03:03:28 +0000 (22:03 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 22 Feb 2020 13:11:34 +0000 (08:11 -0500)
This reveals that the grabs for popover menus
always fail now, causing the menus to not properly
hide.

gdk/wayland/gdksurface-wayland.c

index 2174bdf72a481905e6e8468b6cad82b770c357f3..c761611dbcffaf84ff54d682efe8d3d8c381cc74 100644 (file)
@@ -2799,18 +2799,28 @@ gdk_wayland_surface_present_popup (GdkSurface     *surface,
       if (surface->autohide)
         {
           GrabPrepareData data;
+          GdkGrabStatus result;
 
           data = (GrabPrepareData) {
             .width = width,
             .height = height,
             .layout = layout,
           };
-          gdk_seat_grab (gdk_display_get_default_seat (surface->display),
-                         surface,
-                         GDK_SEAT_CAPABILITY_ALL,
-                         TRUE,
-                         NULL, NULL,
-                         show_grabbing_popup, &data);
+
+          result = gdk_seat_grab (gdk_display_get_default_seat (surface->display),
+                                  surface,
+                                  GDK_SEAT_CAPABILITY_ALL,
+                                  TRUE,
+                                  NULL, NULL,
+                                  show_grabbing_popup, &data);
+          if (result != GDK_GRAB_SUCCESS)
+            {
+              const char *grab_status[] = {
+                "success", "already grabbed", "invalid time",
+                "not viewable", "frozen", "failed"
+              };
+              g_warning ("Grab failed: %s", grab_status[result]);
+            }
         }
       else
         {